package com.tonann.app.mapper;

import com.tonann.app.domain.AppSensorRecordDay;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;

/**
 * 运行记录Mapper接口
 *
 * @author tonann
 * @date 2022-10-21
 */
@Mapper
public interface AppSensorRecordDayMapper  extends BaseMapper<AppSensorRecordDay> {
    /**
     * 查询运行记录
     *
     * @param recordId 运行记录主键
     * @return 运行记录
     */
    public AppSensorRecordDay selectAppSensorRecordDayByRecordId(Long recordId);

    /**
     * 查询运行记录列表
     *
     * @param appSensorRecord 运行记录
     * @return 运行记录集合
     */
    public List<AppSensorRecordDay> selectAppSensorRecordDayList(AppSensorRecordDay appSensorRecord);

    /**
     * 新增运行记录
     *
     * @param appSensorRecord 运行记录
     * @return 结果
     */
    public int insertAppSensorRecordDay(AppSensorRecordDay appSensorRecord);

    /**
     * 修改运行记录
     *
     * @param appSensorRecord 运行记录
     * @return 结果
     */
    public int updateAppSensorRecordDay(AppSensorRecordDay appSensorRecord);



    @Override
    public int insertBatch(List<AppSensorRecordDay> list);

    /**
     * 删除运行记录
     *
     * @param recordId 运行记录主键
     * @return 结果
     */
    public int deleteAppSensorRecordDayByRecordId(Long recordId);

    /**
     * 批量删除运行记录
     *
     * @param recordIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAppSensorRecordDayByRecordIds(Long[] recordIds);

    List<AppSensorRecordDay> selectAppSensorRecordDayListByInterval(@Param("sensorId") Long sensorId, @Param("interval") Integer interval);

    List<AppSensorRecordDay> selectAppSensorRecordDayListBySensorIdsAndInterval(@Param("sensorIds")List<Long> sensorIds, @Param("interval") Integer interval);

    AppSensorRecordDay selectPreNoZeroAppSensorRecordByRecordId(@Param("recordId") Long recordId,@Param("sensorId") Long sensorId);
    AppSensorRecordDay selectPreNoZeroAppSensorRecordByTime(@Param("createTime") LocalDate createTime, @Param("sensorId") Long sensorId);

    List<AppSensorRecordDay> selectList(List<Long> list);
}
